package p.ithorns.integration.aop;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import p.ithorns.integration.aop.introduction.Animal;
import p.ithorns.integration.aop.introduction.Dog;

import javax.annotation.Resource;

/**
 * AopApp
 *
 * @author Ht.L
 * @date 2024-03-08 14:31
 * @since 1.0.0
 */
@SpringBootApplication
public class AopApp implements CommandLineRunner {

    @Resource
    ApplicationContext ctx;

    public static void main(String[] args) {
        SpringApplication.run(AopApp.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
//        Dog dog = ctx.getBean(Dog.class);
//        dog.run();
//        System.out.println("Animal.class.isAssignableFrom(dog.getClass()) = " + Animal.class.isAssignableFrom(dog.getClass()));
//        Animal animal = (Animal) dog;
//        animal.eat();
    }
}